<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../css/public.css" media="all">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>个人信息</legend>
        </fieldset>

        <form class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">头像</label>
                <div class="layui-input-block">
                    
                    <div style="width: 132px;">
                        <div class="layui-upload-list">
                            <img class="layui-upload-img" id="ID-upload-demo-img" style="width: 100%; height: 92px;">
                            <div id="ID-upload-demo-text"></div>
                        </div>
                        <button type="button" class="layui-btn" id="ID-upload-demo-btn">
                            <i class="layui-icon layui-icon-upload"></i> 单图片上传
                        </button><br><br>
                        <div class="layui-progress layui-progress-big" lay-showPercent="yes" lay-filter="filter-demo">
                            <div class="layui-progress-bar" lay-percent=""></div>
                        </div>
                    </div>
                </div>
            </div><br><br>
            <div class="layui-form-item">
                <label class="layui-form-label">账号</label>
                <div class="layui-input-block">
                    <input type="text" name="username" autocomplete="off" class="layui-input">
                </div>
            </div><br><br>

            <div class="layui-form-item">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="name" autocomplete="off" class="layui-input">
                </div>
            </div><br><br>

            <div class="layui-form-item">
                <label class="layui-form-label">身份证号码</label>
                <div class="layui-input-block">
                    <input type="text" name="Identity " autocomplete="off" class="layui-input">
                </div>
            </div><br><br>

            <div class="layui-form-item">
                <label class="layui-form-label">手机号</label>
                <div class="layui-input-block">
                    <input type="text" name="phone" autocomplete="off" class="layui-input">
                </div>
            </div><br><br>

            <div class="layui-form-item">
                <label class="layui-form-label">电子邮箱</label>
                <div class="layui-input-block">
                    <input type="text" name="emil" autocomplete="off" class="layui-input">
                </div>
            </div>
            
            <div class="layui-form-item">
                <button class="layui-btn" lay-submit="" lay-filter="demo2">跳转式提交</button>
            </div>
        </form>
    </div>
</div>

<script src="../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'layedit', 'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;

        //监听提交
        form.on('submit(demo1)', function (data) {
            layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            })
            return false;
        });
    });
    layui.use(function() {
						var upload = layui.upload;
						var layer = layui.layer;
						var element = layui.element;
						var $ = layui.$;
						// 单图片上传
						var uploadInst = upload.render({
							elem: '#ID-upload-demo-btn',
							url: '', // 实际使用时改成您自己的上传接口即可。
							before: function(obj) {
								obj.preview(function(index, file, result) {
									$('#ID-upload-demo-img').attr('src', result);
								});

								element.progress('filter-demo', '0%');
								layer.msg('上传中', {
									icon: 16,
									time: 0
								});
							},
							done: function(res) {
								if (res.code > 0) {
									return layer.msg('上传失败');
								}
								// 上传成功的一些操作
								// …
								$('#ID-upload-demo-text').html(''); // 置空上传失败的状态
							},
							// 进度条
							progress: function(n, elem, e) {
								element.progress('filter-demo', n + '%'); // 可配合 layui 进度条元素使用
								if (n == 100) {
									layer.msg('上传完毕', {
										icon: 1
									});
								}
							}
						});
					});
</script>

</body>
</html>